package situ.autoweter.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import situ.autoweter.service.SyMetertypeService;
import situ.autoweter.entity.SyMetertype;
import java.util.*;
/**
 * SyMetertype的路由接口服务
 * 
 * @author 胡文
 *
 */
@Controller
public class SyMetertypeController {

	/** SyMetertypeService服务 */
	@Autowired
	private SyMetertypeService syMetertypeService;
	
	/**
	 * 查询所有SyMetertype数据的方法
	 * @param value
	 * @return
	 */
	@RequestMapping(value = "querySyMetertype", produces = {"application/json;charset=UTF-8"})
	public String find(SyMetertype value,Map map) {
		 List<SyMetertype> list= syMetertypeService.find(value);
         map.put("items",list);
         return "页面名称自己改";
	}
	
	/**
	 * 通过id查询SyMetertype数据的方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "querySyMetertypeById/{id}", produces = {"application/json;charset=UTF-8"})
	public String findOne(@PathVariable(name="id") Object id,Map map) {
        SyMetertype obj=  syMetertypeService.findOne(id);
        map.put("SyMetertype",obj);
        return "页面名称自己改";
	}
	
	/**
	 * 插入SyMetertype属性不为空的数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "saveSyMetertype", produces = {"application/json;charset=UTF-8"})
	public String save(SyMetertype value) {
		  syMetertypeService.saveNotNull(value);
        return "redirect:/querySyMetertype";
	}
	
	/**
	 * 更新SyMetertype属性不为空的数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "updateSyMetertype", produces = {"application/json;charset=UTF-8"})
	public String update(SyMetertype value) {
		  syMetertypeService.updateNotNullById(value);
          return "redirect:/querySyMetertype";
	}
	
	/**
	 * 通过id删除SyMetertype数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "delSyMetertypeById/{id}", produces = {"application/json;charset=UTF-8"})
	public String delete(@PathVariable(name="id") Object id) {
		  syMetertypeService.deleteById(id);
          return "redirect:/querySyMetertype";
	}
}
